/**
 * Created by ebalmes Oct 5, 2009 8:50:40 AM
 * 
 */
package model.types;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Patient implements Comparable<Patient>, Serializable
{
  private String name;
  private int tajNumber;
  private String mothersName;
  private Date dateOfBirth;
  private String placeOfBirth;
  private String address;
  
  private List<MedEx> medExList = new ArrayList<MedEx>();
  
  /**
   * Constructor.
   * @param name, The patient's name.
   * @param tajNumber, The TAJ number.
   * @param mothersName, Mother's name.
   * @param dateOfBirth, The date of birth.
   * @param placeOfBirth, The place of Birth.
   * @param address, The address.
   */
  public Patient(String name, int tajNumber, String mothersName,
      Date dateOfBirth, String placeOfBirth, String address) {
    super();
    this.name = name;
    this.tajNumber = tajNumber;
    this.mothersName = mothersName;
    this.dateOfBirth = dateOfBirth;
    this.placeOfBirth = placeOfBirth;
    this.address = address;
  }

  /**
   * @see java.lang.Object#hashCode()
   */
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + tajNumber;
    return result;
  }

  /**
   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (!(obj instanceof Patient))
      return false;
    Patient other = (Patient) obj;
    if (tajNumber != other.tajNumber)
      return false;
    return true;
  }

  /**
   * @return the name
   */
  public String getName() {
    return name;
  }

  /**
   * @param name the name to set
   */
  public void setName(String name) {
    this.name = name;
  }

  /**
   * @return the mothersName
   */
  public String getMothersName() {
    return mothersName;
  }

  /**
   * @param mothersName the mothersName to set
   */
  public void setMothersName(String mothersName) {
    this.mothersName = mothersName;
  }

  /**
   * @return the dateOfBirth
   */
  public Date getDateOfBirth() {
    return dateOfBirth;
  }

  /**
   * @param dateOfBirth the dateOfBirth to set
   */
  public void setDateOfBirth(Date dateOfBirth) {
    this.dateOfBirth = dateOfBirth;
  }

  /**
   * @return the placeOfBirth
   */
  public String getPlaceOfBirth() {
    return placeOfBirth;
  }

  /**
   * @param placeOfBirth the placeOfBirth to set
   */
  public void setPlaceOfBirth(String placeOfBirth) {
    this.placeOfBirth = placeOfBirth;
  }

  /**
   * @return the address
   */
  public String getAddress() {
    return address;
  }

  /**
   * @param address the address to set
   */
  public void setAddress(String address) {
    this.address = address;
  }

  /**
   * @return the tajNumber
   */
  public int getTajNumber() {
    return tajNumber;
  }
  
  /**
   * Adds medex.
   * @param medEx the medex to be added.
   */
  public void addMedEx(MedEx medEx) {
    medExList.add(medEx);
  }
  
  /**
   * Removes medex.
   * @param medEx the medex to be removed.
   */
  public void removeMedEx(MedEx medEx) {
    medExList.remove(medEx);
  }

  @Override
  public int compareTo(Patient o) {
    return name.compareTo(o.getName());
  }

  public List<MedEx> getMedExList() {
    return medExList;
  }
  
  
}
